package com.googlecode.ascrblr.api.data;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import javax.xml.parsers.ParserConfigurationException;

public abstract class GeoawareFeed extends Feed {
	
	/** country name */
	private String place;
	
	public GeoawareFeed(String place) throws ParserConfigurationException {
		super();
		this.place = place;
	}

	@Override
	public String getUrl() throws UnsupportedEncodingException {

		return 	WEBSERVICE_URL + "place/" + 
				URLEncoder.encode(place, ENCODING) + 
				"/";
		
	}
	
	public static class TopArtists extends GeoawareFeed {
		
		private static final String DATA_XML = "topartists.xml";
		
		/**
         * Top artists of a specific place. The Format of this
         * <code>Feed</code> is is XML.
         * 
         * @param place
         *            Place name i.e. Switzerland
         * @throws ParserConfigurationException
         */
		public TopArtists(String place) throws ParserConfigurationException {
			super(place);
		}

		@Override
		public String getUrl() throws UnsupportedEncodingException {
			return 	super.getUrl() + DATA_XML;
		}	
		
	}
	
	public static class TopTracks extends GeoawareFeed {
		
		private static final String DATA_XML = "toptracks.xml";
		
		/**
         * Top tracks of a specific place. The Format of this
         * <code>Feed</code> is is XML.
         * 
         * @param place
         *            Place name i.e. Switzerland
         * @throws ParserConfigurationException
         */
		public TopTracks(String place) throws ParserConfigurationException {
			super(place);
		}

		@Override
		public String getUrl() throws UnsupportedEncodingException {
			return 	super.getUrl() + DATA_XML;
		}	
		
	}
}
